var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/";


function deleteMany(collection,query){
    MongoClient.connect(url, function(err, db) {
        if (err) throw err;
        var dbo = db.db("mongo");
        var whereStr = query;  // 查询条件
        dbo.collection(collection).deleteMany(whereStr, function(err, obj) {
            if (err) throw err;
            console.log(obj.result.n + " 条文档被删除");
            db.close();
        });
    });
}

module.exports = deleteMany
